package com.ruoyi.cms.service.impl;

import java.util.List;

import com.ruoyi.cms.domain.CmsPolicyContent;
import com.ruoyi.cms.mapper.CmsPolicyContentMapper;
import com.ruoyi.cms.service.ICmsPolicyContentService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 政策Service业务层处理
 * 
 * @author hct
 * @date 2022-01-22
 */
@Service
public class CmsPolicyContentServiceImpl implements ICmsPolicyContentService
{
    @Autowired
    private CmsPolicyContentMapper cmsPolicyContentMapper;

    /**
     * 查询政策
     * 
     * @param id 政策主键
     * @return 政策
     */
    @Override
    public CmsPolicyContent selectCmsPolicyContentById(Long id)
    {
        return cmsPolicyContentMapper.selectCmsPolicyContentById(id);
    }

    /**
     * 查询政策列表
     * 
     * @param cmsPolicyContent 政策
     * @return 政策
     */
    @Override
    public List<CmsPolicyContent> selectCmsPolicyContentList(CmsPolicyContent cmsPolicyContent)
    {
        return cmsPolicyContentMapper.selectCmsPolicyContentList(cmsPolicyContent);
    }

    /**
     * 新增政策
     * 
     * @param cmsPolicyContent 政策
     * @return 结果
     */
    @Override
    public int insertCmsPolicyContent(CmsPolicyContent cmsPolicyContent)
    {
        cmsPolicyContent.setCreateTime(DateUtils.getNowDate());
        return cmsPolicyContentMapper.insertCmsPolicyContent(cmsPolicyContent);
    }

    /**
     * 修改政策
     * 
     * @param cmsPolicyContent 政策
     * @return 结果
     */
    @Override
    public int updateCmsPolicyContent(CmsPolicyContent cmsPolicyContent)
    {
        cmsPolicyContent.setUpdateTime(DateUtils.getNowDate());
        return cmsPolicyContentMapper.updateCmsPolicyContent(cmsPolicyContent);
    }

    /**
     * 批量删除政策
     * 
     * @param ids 需要删除的政策主键
     * @return 结果
     */
    @Override
    public int deleteCmsPolicyContentByIds(Long[] ids)
    {
        return cmsPolicyContentMapper.deleteCmsPolicyContentByIds(ids);
    }

    /**
     * 删除政策信息
     * 
     * @param id 政策主键
     * @return 结果
     */
    @Override
    public int deleteCmsPolicyContentById(Long id)
    {
        return cmsPolicyContentMapper.deleteCmsPolicyContentById(id);
    }
}
